
<div id="app">
    <section class="content-header">
        <h1>
            <small>订单租期列表</small>
        </h1>
    </section>

    <section class="content">
        <div class="row">
            <div class="col-md-12">
                <div class="box">
                    <div class="box-header with-border">
                        <div class="box-tools">
                            <div class="btn-group pull-right" style="margin-right: 5px">
                                <a style="margin:0px 5px;" href="/admin/orderStages/orderStagesExcel{{$excel_url}}" class="btn btn-sm btn-default" target="_blank"> <span class="hidden-xs">导出</span></a>
                            </div>
                        </div>

                        <span>

    <a class="btn btn-sm btn-primary grid-refresh" title="刷新"><i class="fa fa-refresh"></i><span class="hidden-xs"> 刷新</span></a>


  </span>
                    </div>



                    <!-- /.box-header -->
                    <!--数据列表开始   -->
                    <div class="box-body table-responsive no-padding">
                        <table class="table table-hover" style="width:120%;max-width: 150%;">
                            <thead >
                            <tr >
                                <th>订单状态</th>
                                <th>订单号</th>
                                <th>下单时间</th>
                                <th>用户信息</th>
                                <th>订单来源</th>
                                <th>总期数</th>
                                <th>当前期数</th>
                                <th>分期状态</th>
                                <th>月租金</th>
                                <th>意外保障费</th>
                                <th>安装费</th>
                                <th>优惠券减免金额</th>
                                <th>应付租金</th>
                                <th>还款时间</th>
                                <th>最迟还款时间</th>
                                <th>已还款金额</th>
                                <th>逾期天数</th>
                                <th>逾期金额</th>
                                <th>资金流水号</th>
                                <th>第三方单号</th>
                                <th>支付方式</th>
                                <th>分期生成时间</th>
                            </tr>
                            </thead>

                            <tbody>

                            @if (!empty($data['data']))
                                @foreach($data['data'] as $v)
                                    <tr >
                                        <td >
                                            {{ $v['order_status'] }}
                                        </td>
                                        <td >
                                            {{$v['order_id']}}
                                        </td>
                                        <td >
                                            {{$v['order_create_time']}}
                                        </td>
                                        <td >
                                            姓名：{{$v['user_name']}},
                                            手机号：{{$v['user_phone']}}
                                        </td>
                                        <td >
                                            {{$v['order_comefrom']}}
                                        </td>
                                        <td >
                                            {{$v['order_tenancy_term']}}
                                        </td>

                                        <td >
                                            {{$v['current_tenancy_term']}}
                                        </td>
                                        <td >
                                            {{$v['fq_status']}}
                                        </td>
                                        <td >
                                            {{$v['monthly_rent']}}
                                        </td>
                                        <td >
                                            {{$v['order_goods_insurance']}}
                                        </td>
                                        <td >
                                            {{$v['goods_installation_charge']}}
                                        </td>
                                        <td >
                                            {{$v['cou_credit_amount']}}
                                        </td>
                                        <td >
                                            {{$v['total_pay']}}
                                        </td>
                                        <td >
                                            {{$v['repayment_time']}}
                                        </td>
                                        <td >
                                            {{$v['last_repayment_time']}}
                                        </td>
                                        <td >
                                            {{$v['paid_monthly_rent']}}
                                        </td>
                                        <td >
                                            {{$v['days_overdue']}}
                                        </td>
                                        <td >
                                            {{$v['amount_override']}}
                                        </td>
                                        <td >
                                            {{$v['alipay_fund_order_no']}}
                                        </td>
                                        <td >
                                            {{$v['out_order_id']}}
                                        </td>

                                        <td >
                                            {{$v['order_stages_pay']}}
                                        </td>
                                        <td >
                                            {{$v['create_time']}}
                                        </td>
                                    </tr>
                                @endforeach
                            @endif
                            </tbody>
                        </table>
                    </div>
                    <!--数据列表结束-->



                    <!-- 分页开始    -->
                    <div class="box-footer clearfix">
                        @if($data['data'])
                            从 <b>{{$data['from']}}</b> 到 <b>{{$data['to']}}</b> ，总共 <b>{{$data['total']}}</b> 条
                            <ul class="pagination pagination-sm no-margin pull-right">
                                <!-- Previous Page Link -->
                                @if($data['page_list'])
                                    <li class="page-item @if($data['current_page']==1) disabled @endif ">
                                        @if($data['current_page']>1)
                                            <a class="page-link" data-href="{{$data['page_url']}}&page={{$data['up_page']}}" rel="next">&laquo;</a>
                                        @else
                                            <span class="page-link">&laquo;</span>
                                        @endif</li>
                                    @foreach($data['page_list'] as $v)
                                        @if($v=='...')
                                            <li class="page-item disabled"><span class="page-link">{{$v}}</span></li>
                                        @endif
                                        @if($v==$data['current_page'])
                                            <li class="page-item active"><span class="page-link">{{$v}}</span></li>
                                        @elseif($v!='...')
                                            <li class="page-item"><a class="page-link" data-href="{{$data['page_url']}}&page={{$v}}">{{$v}}</a></li>
                                        @endif
                                    @endforeach
                                    <li class="page-item @if($data['current_page']==$data['last_page']) disabled @endif ">
                                        @if($data['current_page']<$data['last_page'])
                                            <a class="page-link" data-href="{{$data['page_url']}}&page={{$data['next_page']}}" rel="next">&raquo;</a>
                                        @else
                                            <span class="page-link">&raquo;</span>
                                        @endif</li>
                                @endif
                            </ul>

                            <label class="control-label pull-right" style="margin-right: 10px; font-weight: 100;">
                                <small>显示</small>&nbsp;
                                <select class="input-sm grid-per-pager" name="per-page">
                                    <option value="{{$data['page_url']}}&per_page=10" >10</option>
                                    <option value="{{$data['page_url']}}&per_page=20" selected>20</option>
                                    <option value="{{$data['page_url']}}&per_page=30" >30</option>
                                    <option value="{{$data['page_url']}}&per_page=50" >50</option>
                                    <option value="{{$data['page_url']}}&per_page=100" >100</option>
                                </select>
                                &nbsp;<small>条</small>
                            </label>
                        @else
                            <div style="text-align: center;margin:20px;">未查到数据</div>
                        @endif
                    </div>
                    <!-- 分页结束    -->

                    <!-- /.box-body -->
                </div>
            </div>
        </div>

    </section>
</div>

<script data-exec-on-popstate>

    $(function () {

        //多选id数组
        var selectedRows = function () {
            var selected = [];
            $('.grid-row-checkbox:checked').each(function(){
                selected.push($(this).data('id'));
            });
            return selected;
        }

        //tr选中样式控制
        $('.grid-row-checkbox').iCheck({checkboxClass:'icheckbox_minimal-blue'}).on('ifChanged', function () {
            if (this.checked) {
                $(this).closest('tr').css('background-color', '#ffffd5');
            } else {
                $(this).closest('tr').css('background-color', '');
            }
        });


        $('.grid-select-all').iCheck({checkboxClass:'icheckbox_minimal-blue'});
        $('.grid-select-all').on('ifChanged', function(event) {
            if (this.checked) {
                $('.grid-row-checkbox').iCheck('check');
            } else {
                $('.grid-row-checkbox').iCheck('uncheck');
            }
        });

        //刷新
        $('.grid-refresh').on('click', function() {
            $.pjax.reload('#pjax-container');
            toastr.success('刷新成功 !');
        });

        //搜索
        $('.shaixuan-filter-btn').unbind('click');
        $('.shaixuan-filter-btn').click(function (e) {
            if ($('#filter-box').is(':visible')) {
                $('#filter-box').addClass('hide');
            } else {
                $('#filter-box').removeClass('hide');
            }
        });
        @if($where)
        $('#filter-box').removeClass('hide');
        @endif


        //改变分页量
        $('.grid-per-pager').on("change", function(e) {
            $.pjax({url: this.value, container: '#pjax-container'});
        });

        //分页
        $("a.page-link").click(function(e){
            var url=$(this).attr('data-href');
            $.pjax({url:url, container: '#pjax-container'});
        })
    });


</script>